home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Compendium Deluxe 2
/
LSD and 17bit Compendium Deluxe - Volume II.iso
/
a
/
prog
/
misc
/
guienv374.lha
/
GUIEnvironment
/
M2Amiga
/
Examples
/
RequesterExample.mod
< prev
next >
Wrap
Text File
|
1994-10-31
|
6KB
|
136 lines
(****************************************************************************
$RCSfile: RequesterExample.mod $
$Revision: 1.5 $
$Date: 1994/10/31 17:12:06 $
GUIEnvironment example: Requester
M2Amiga Modula-2 Compiler V4.3
Copyright © 1994, Carsten Ziegeler
Augustin-Wibbelt-Str.7, 33106 Paderborn, Germany
****************************************************************************)
MODULE RequesterExample;
(* This example shows all available requesters using ReqTools if available *)
(* RequesterExample uses the following catalog strings 201.. : texts
240.. : gadgets
250 : END *)
FROM SYSTEM IMPORT ADR, ADDRESS, TAG;
FROM GadToolsD IMPORT GtTags, textKind;
FROM IntuitionD IMPORT WindowPtr, WindowFlagSet, WindowFlags, IDCMPFlagSet,
IDCMPFlags;
IMPORT D : GUIEnvD,
L : GUIEnvL,
GS: GUIEnvSupport;
CONST version = ADR("$VER: RequesterExample 37.4 (31.10.94)\n");
VAR win : WindowPtr;
gui : D.GUIInfoPtr;
choose : LONGINT;
file, dir : ARRAY[0..255] OF CHAR;
tagbuf : ARRAY[0..19] OF LONGCARD;
args : ARRAY[0..4] OF ADDRESS; (* for the arguments *)
BEGIN
win := L.OpenGUIWindowA( 50, 50, 300, 100, ADR("GUIEnvironment - RequesterExample"),
IDCMPFlagSet{closeWindow, newSize,
refreshWindow},
WindowFlagSet{activate, windowDepth, windowClose,
windowDrag}, NIL, NIL);
IF win # NIL THEN
gui := L.CreateGUIInfoA(win, TAG(tagbuf, D.guiTextFont, GS.TopazAttr(),
D.guiCatalogFile, ADR("GUIEnvExamples.catalog"),
D.guiGadgetCatalogOffset, 240, NIL));
IF gui # NIL THEN
L.CreateGUIGadgetA(gui, 10, 40, 280, 20, textKind,
TAG(tagbuf, gttxText, L.GetCatStr(gui, 240, ADR("Use requesters")),
gttxBorder, TRUE, NIL));
IF L.DrawGUIA(gui, NIL) = D.geDone THEN
(* Return value not needed, ok requester *)
IGNORE L.GUIRequestA(gui, ADR("This is the requester demo !\nEnjoy it !"),
D.gerRTOKKind,
TAG(tagbuf, D.gerLocaleID, 201, NIL));
(* doitReqKind *)
WHILE L.GUIRequestA(gui, ADR("Do you want to see this requester again ?"),
D.gerRTDoItKind,
TAG(tagbuf, D.gerGadgets, L.GetCatStr(gui, 230, ADR("YES|NO")),
D.gerLocaleID, 202, NIL)) = D.gerYes DO
END;
(* Yes/no/cancel requester *)
choose := L.GUIRequestA(gui, ADR("Do you want to see some asl requesters ?"),
D.gerRTYNCKind,
TAG(tagbuf, D.gerGadgets, L.GetCatStr(gui, 231, ADR("YES|NO|CANCEL")),
D.gerLocaleID, 203, NIL));
IF choose = D.gerYes THEN
(* And now the asl requesters supported by GUIEnvironment *)
file := "guienv.library";
dir := "sys:libs";
(* First a requester to choose the best library ! *)
IF L.GUIRequestA(gui, ADR("Choose the best library"), D.gerRTFileKind,
TAG(tagbuf, D.gerPattern, ADR("#?.library"),
D.gerFileBuffer, ADR(file),
D.gerDirBuffer, ADR(dir),
D.gerLocaleID, 204, NIL)) = D.gerYes THEN
args[0] := ADR(dir);
args[1] := ADR(file);
IGNORE L.GUIRequestA(gui, ADR("You choice was:\ndir : %s\nfile: %s"),
D.gerRTOKKind, TAG(tagbuf, D.gerArgs, ADR(args),
D.gerLocaleID, 205, NIL));
ELSE
IGNORE L.GUIRequestA(gui, ADR("You cancelled it ! (Sniff..)"),
D.gerRTOKKind,
TAG(tagbuf, D.gerLocaleID, 206, NIL));
END;
(* And now a save dir requester with no pattern gadget *)
dir := "ram:t";
IF L.GUIRequestA(gui, ADR("Choose directory to save something..."),
D.gerRTDirKind, TAG(tagbuf, D.gerNameBuffer, ADR(dir),
D.gerPattern, NIL,
D.gerSave, TRUE,
D.gerLocaleID, 207, NIL)) = D.gerYes THEN
args[0] := ADR(dir);
IGNORE L.GUIRequestA(gui, ADR("You selected directory:\n%s"),
D.gerRTOKKind, TAG(tagbuf, D.gerArgs, ADR(args),
D.gerLocaleID, 208, NIL));
ELSE
IGNORE L.GUIRequestA(gui, ADR("You cancelled it ! (Snuff..)"),
D.gerRTOKKind,
TAG(tagbuf, D.gerLocaleID, 209, NIL));
END;
ELSIF choose = D.gerNo THEN
IGNORE L.GUIRequestA(gui, ADR("Click OK to quit !"), D.gerRTOKKind,
TAG(tagbuf, D.gerLocaleID, 210, NIL));
END;
END;
END;
END;
CLOSE
IF win # NIL THEN
L.CloseGUIWindow(win);
win := NIL;
END;
END RequesterExample.